const roleColumns = [
  {
    title: "序号",
    dataIndex: "index",
    key: "index",
    customRender: (text, record, index) => `${index + 1}`,
    align: "center",
  },
  {
    title: "角色编码",
    dataIndex: "roleCode",
    key: "roleCode",
    align: "center",
  },
  {
    title: "角色名称",
    dataIndex: "name",
    key: "name",
    align: "center",
  },
  {
    title: "角色描述",
    dataIndex: "roleDescription",
    key: "roleDescription",
    align: "center",
  },

  {
    width:200,
    title: "操作",
    dataIndex: "action",
    align: "center",
    scopedSlots: { customRender: "action" },
  },
];

const permissionColumns = [
  {
    title: "名称",
    dataIndex: "name",
    key: "name",
    align: "center",
  },
  {
    title: "路径名称",
    dataIndex: "pathName",
    key: "pathName",
    align: "center",
  },
  {
    title: "路径",
    dataIndex: "path",
    key: "path",
    align: "center",
  },
  {
    title: "类型",
    key: "type",
    dataIndex: "type",
    align: "center",
    customRender: (text, record, index) => {
      return caseType(text);
    },
  },
  {
    title: "排序",
    key: "sort",
    dataIndex: "sort",
    align: "center",
  },
  {
    width:150,
    title: "操作",
    dataIndex: "action",
    align: "center",
    scopedSlots: { customRender: "action" },
  },
];

function caseType(type) {
  switch (type) {
    case "0":
      return "App";
    case "1":
      return "模块";
    case "2":
      return "页面";
    case "3":
      return "按钮";
  }
}

export { roleColumns, permissionColumns };
